<!DOCTYPE html>
<html>
<head>
    <title>支部简介</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

    <meta name="description" content="">

    <link rel="stylesheet" href="dist/lib/weui.css">
    <link rel="stylesheet" href="dist/css/build.css">
    <link rel="stylesheet" href="dist/css/jquery-weui.css">
    <link href="dist/lib/imgUp.css?v2" rel="stylesheet"/>
    <link rel="stylesheet" href="dist/css/autosearch.css">
    <style>
        body {
            background: #f5f5f5
        }

        .weui-cells.weui-cells_form {
            background: #fff;
            border-bottom: 1px solid #EDEDED;
            /*-moz-box-shadow: 2px 2px 5px #333333;*/
            /*-webkit-box-shadow: 0px 2px 15px #eee;*/
            /*box-shadow: 0px 2px 15px #eee;*/
        }

        .weui-uploader__input-box {
            margin-top: 5px;
        }

        #cont img {
            width: 100%;
        }

        .ui-autosearch-content {
            height: 100%;
        }

        .ui-autosearch-content .item {
            padding-top: 5px;
            padding-bottom: 5px;
        }

    </style>
</head>

<body>


<div class="weui-cells weui-cells_form">
    <div class="weui-cell">
        <div class="weui-cell__hd "><label class="weui-label">支部名称</label></div>
        <div class="weui-cell__bd">
            <input class="weui-input autosearch " id="title" value="" type="text"
                   placeholder="暂无支部信息">
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">创立日期</label></div>
        <div class="weui-cell__bd">
            <input class="weui-input" id="time" value="-" type="text" disabled="disabled"
                   placeholder="">
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">组织架构</label></div>
        <div class="weui-cell__bd">
            <input class="weui-input" id="organizational" value="-" type="text" disabled="disabled"
                   placeholder="">
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">更新日期</label></div>
        <div class="weui-cell__bd">
            <input class="weui-input" id="updata" value="-" type="text" disabled="disabled"
                   placeholder="">
        </div>
    </div>
</div>

<div class="weui-cells__title">支部简介</div>
<div class="weui-cells weui-cells_form">
    <div class="weui-cell">
        <div class="weui-cell__bd" id="cont">
            暂无内容
        </div>
    </div>
</div>

<div class="weui-msg__extra-area">
    <div class="weui-footer">
        <p class="weui-footer__links">
            <a href="javascript:void(0);" class="weui-footer__link">中共东莞市律师行业委员会</a>
        </p>
        <p class="weui-footer__text">Copyright © 2008-2020</p>
    </div>
</div>

<script src="dist/lib/jquery-2.1.4.js"></script>
<script src="dist/lib/fastclick.js"></script>
<script>
    $(function () {
        FastClick.attach(document.body);
    });
</script>

<script src="dist/js/jquery-weui.js"></script>
<script src="dist/lib/vue.min.js"></script>
<script src="dist/lib/http.js"></script>
<script src="dist/lib/imgUp.js"></script>
<script src="dist/lib/jquery.cookie.js"></script>
<script src="dist/lib/autosearch.js"></script>
<script>
    $http.getUserSignIn(true, 'introduction.html');
    console.log($http.getUserSignIn());

    getData();

    function getData() {
        var departmentId = $http.getUserSignIn().departmentId;
        if (departmentId == 0) return;
        $http.post($http.getZBMC(departmentId)).then(function (data) {
            if (data.success == true) {
                $("#title").attr("value", data.data[0].name);
                $("#time").attr("value", dateUtils.formatDate(data.data[0].createtime, 'YY-MM-DD'));
                
                // 这个值，不知道
                $("#organizational").attr("value", data.data[0].name);

                $("#updata").attr("value", dateUtils.formatDate(data.data[0].opdatetime, 'YY-MM-DD hh:mm'));
                if (data.data[0].notice == '' || data.data[0].notice == null) {
                    document.getElementById('cont').innerHTML = '暂无内容';
                } else {
                    document.getElementById('cont').innerHTML = dateUtils.urll(data.data[0].notice);
                }

            } else {
                window.location.href = 'index.html';
            }

        }, function (err) {
            console.log(err);
            return err;
        });
    }

    getLsDepartment();

    function callback(data){
        $("#title").attr("value", data.name);
        $("#time").attr("value", dateUtils.formatDate(data.createtime, 'YY-MM-DD'));
        if (data.notice == '' || data.notice == null) {
            document.getElementById('cont').innerHTML = '暂无内容';
        } else {
            document.getElementById('cont').innerHTML = dateUtils.urll(data.notice);
        }
    }
    function getLsDepartment() {

        // falg =false 根据缓存手机更新缓存
        $http.post($http.getAllZBMC(0)).then(function (data) {
            if (data.success == true) {
                // 永久保存登录信息
                localStorage.Department = JSON.stringify(data['data']);
            } else {
                $.alert("错误", function () {
                    // window.location.href = 'index.html';
                });
            }
        });
    }

    /**
     * 输入搜索
     * @type {*|void|jQuery|HTMLElement}
     */
    var input = $('.autosearch');
    var autosearch = new AutoSearch();
    var getdata = JSON.parse(localStorage.Department);
    autosearch.init({
        input: input,
        autoShow: true,
        data: getdata,
        valueObj: '#title',
        filterColumn: ['name'],
        column: ['name'],
        valueName: "name",
        callback:callback
    });

</script>
</body>
</html>
